<!DOCTYPE html>
<!-- 企业注册界面 -->
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="layui/css/layui.css">
    <style type="text/css">
        .container{
            width: 420px;
            height: 320px;
            min-height: 320px;
            max-height: 320px;
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            margin: auto;
            padding: 20px;
            z-index: 130;
            border-radius: 8px;
            background-color: #fff;
            box-shadow: 0 3px 18px rgba(100, 0, 0, .5);
            font-size: 16px;
        }
        .close{
            background-color: white;
            border: none;
            font-size: 18px;
            margin-left: 410px;
            margin-top: -10px;
        }

        .layui-input{
            border-radius: 5px;
            width: 300px;
            height: 40px;
            font-size: 15px;
        }
        .layui-form-item{
            margin-left: -20px;
        }
        #logoid{
            margin-top: -16px;
            padding-left:150px;
            padding-bottom: 15px;
        }
        .layui-btn{
            margin-left: -50px;
            border-radius: 5px;
            width: 350px;
            height: 40px;
            font-size: 15px;
        }
        .verity{
            width: 120px;
        }
        .font-set{
            font-size: 13px;
            text-decoration: none;
            margin-left: 120px;
        }
        a:hover{
            text-decoration: underline;
        }
		#img {
		        width: 25px;
		        height: 15px;
		        position: absolute;
		        right: 5px;
		        margin-top: 12px;
		        top: 1px;
		        text-align: right;
				}
		

    </style>
	<title>企业用户注册</title>
</head>
<body>
<form class="layui-form" lay-filter="regcontent" 
id='regform'  onsubmit="return false">
    <div class="container">
<!--        <button class="close" title="关闭">X</button>-->
        <div class="layui-form-mid layui-word-aux">
<!--            <img id="logoid" src="06.png" height="35">-->
            <h3>企业用户注册</h3>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="number"  placeholder="请输入用户名"  required
				lay-verify='required' autocomplete="on" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">密 &nbsp;&nbsp;码</label>
            <div class="layui-input-inline">
                <input type="password" name="password" placeholder="请输入密码" 
				required lay-verify='required'	autocomplete="on" class="layui-input"
        	   id='user-reg-password'>
            </div>
        		 <i><img  id="img" onclick="hideShowPsw()" src='eyes/lock_eye.png' /></i>
        </div>
        
		<div class="layui-form-item">
		    <label class="layui-form-label">确认密码</label>
		    <div class="layui-input-inline">
		        <input type="password" name="repass" placeholder="请再次输入密码" required
				lay-verify='confirmPass|required' 
				autocomplete="on" class="layui-input"
				id='user-reg-repass'>
		    </div>
	
		</div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formReg">注册</button>
            </div>
        </div>
   <!--    <a href="" class="font-set">忘记密码?</a> --><a href="eplogin.html" class="font-set">返回登录</a>
    </div>
</form>
<script type="text/javascript" src="layui/layui.js"></script>
<script type='text/javascript'>
	function hideShowPsw(){
		var demoimg=document.getElementById('img');
		var PWD=document.getElementById('user-reg-password');
		var rePWD=document.getElementById('user-reg-repass');
		if(PWD.type=='password'){
			PWD.type='text';
			rePWD.type='text';
			demoimg.src='eyes/open_eye.png';
			}else{
				PWD.type='password';
				rePWD.type='password';
				demoimg.src='eyes/lock_eye.png'
			}
		}
	
</script>
<script type='text/javascript'>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
			,$=layui.$;
        //日期
        /* laydate.render({
           elem: '#date'
         });
         laydate.render({
           elem: '#date1'
         });

         //创建一个编辑器
         var editIndex = layedit.build('LAY_demo_editor');

         //自定义验证规则
         form.verify({
           title: function(value){
             if(value.length < 5){
               return '标题至少得5个字符啊';
             }
           }
           ,pass: [
             /^[\S]{6,12}$/
             ,'密码必须6到12位，且不能出现空格'
           ]
           ,content: function(value){
             layedit.sync(editIndex);
           }
         });

         //监听指定开关
         form.on('switch(switchTest)', function(data){
           layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
             offset: '6px'
           });
           layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
         });*/
		 //表单验证
		form.verify({
		   confirmPass:function(value){
			layer.msg(value);
			console.log(value);
		   if($('input[name=password]').val()!==value){
			    layer.msg('两次密码不一致');
				return '两次输入的密码不一致！！';
			}
			}
			
		});

        //监听提交
        form.on('submit(formReg)', function(data){
			var user=data.field;
			alert(JSON.stringify(user));
			$.ajax({
				cache:false,
				type:"post",
				dataType:"json",
				url:"/login/enterRegister",
				async:false,
			    data: $("#regform").serialize() ,	 
				error : function() {
				                    alert('操作失败');
				                    },
		   
				success : function(ret) {
					 console.log(ret);
				     if (ret.code===200) {
				                        layer.msg(ret.msg);
				                        layer.closeAll("loading");
										layer.msg(ret.msg,{icon:5});
										layer.msg('注册成功');
				                        window.location.replace("eplogin.html");
				      } else {
				               alert($("#regform").serialize())
							   layer.msg(ret.msg);
					
					
					}
			}});
					return false;
  });
  });
</script>
</body>
</html>